<#assign base=request.contextPath />
<!DOCTYPE html>
<html>
<head>
    <base href="${base}">
    <meta charset="utf-8">
    <title>数据同步-详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${base}/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${base}/layuiadmin/layui/css/formSelects.css" media="all">
    <link rel="stylesheet" href="${base}/css/my.css" media="all">
</head>

<body>

    <div class="layui-form" lay-filter="LAY-form-list" style="padding: 20px 30px 0 0;">
        <input type="hidden" name="oid" value="${(rsyncTable.oid)!}">

        <div class="layui-form-item">
            <label class="layui-form-label required">表名</label>
            <div class="layui-input-inline">
                <input type="text" name="tableName" value="${(rsyncTable.tableName)!}" lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label required">主键列名</label>
            <div class="layui-input-inline">
                <input type="text" name="pkName" value="${(rsyncTable.pkName)!}" lay-verify="required" placeholder="请输入主键列名" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label required">实体名</label>
            <div class="layui-input-inline">
                <input type="text" name="entityName" value="${(rsyncTable.entityName)!}" lay-verify="required" placeholder="请输入实体名" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label required">表中文名</label>
            <div class="layui-input-inline">
                <input type="text" name="tableNameCn" value="${(rsyncTable.tableNameCn)!}" lay-verify="required" placeholder="请输入表中文名" autocomplete="off" class="layui-input">
            </div>
        </div>

        <!-- 组织机构获取测试 -->
        <div class="layui-form-item">
            <label class="layui-form-label">同步方向</label>
            <div class="layui-input-inline">
                <select name="rsyncDir" lay-verify="required">
                    <#if rsyncTable??>
                    <option value="1" ${((rsyncTable.rsyncDir!0)==1)?string('selected','')}>同步到移动端</option>
                    <option value="2" ${((rsyncTable.rsyncDir!0)==2)?string('selected','')}>同步到服务器端</option>
                    <option value="3" ${((rsyncTable.rsyncDir!0)==3)?string('selected','')}>先同步到移动端再同步到服务器端</option>
                    <#else>
                    <option value="1" selected>同步到移动端</option>
                    <option value="2" >同步到服务器端</option>
                    <option value="3" >先同步到移动端再同步到服务器端</option>
                    </#if>
                </select>
            </div>
            <label class="layui-form-label">同步方式</label>
            <div class="layui-input-inline">
                <select name="rsyncType" lay-verify="required">
                    <#if rsyncTable??>
                    <option value="1" ${((rsyncTable.rsyncType!0)==1)?string('selected','')}>增量</option>
                    <option value="2" ${((rsyncTable.rsyncType!0)==2)?string('selected','')}>全量</option>
                    <#else>
                    <option value="1" selected>增量</option>
                    <option value="2" >全量</option>
                    </#if>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">表类型</label>
            <div class="layui-input-inline">
                <select name="basic" lay-verify="required">
                    <#if rsyncTable??>
                    <option value="0" ${(rsyncTable.basic==0)?string('selected','')}>基础表</option>
                    <option value="1" ${(rsyncTable.basic==1)?string('selected','')}>业务表</option>
                    <#else>
                    <option value="0" selected>基础表</option>
                    <option value="1" >业务表</option>
                </#if>
                </select>
            </div>
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select name="enabled" lay-verify="required">
                    <#if rsyncTable??>
                    <option value="0" ${((rsyncTable.enabled!1)==0)?string('selected','')}>禁用</option>
                    <option value="1" ${((rsyncTable.enabled!0)==1)?string('selected','')}>激活</option>
                    <#else>
                    <option value="0" >禁用</option>
                    <option value="1" selected>激活</option>
                </#if>
                </select>
            </div>
        </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-form-submit" id="LAY-form-submit" value="确认添加">
        <input type="button" lay-submit lay-filter="LAY-form-edit" id="LAY-form-edit" value="确认编辑">
    </div>
    </div>

<script src="${base}/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '${base}/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index',
        jwt: '{/}${base}/js/lib/jwt'
    }).use(['index', 'form', 'jwt','treeSelect','jquery', 'formSelects'], function(){
        var $ = layui.$,
            form = layui.form,
            jwt = layui.jwt;
        treeSelect= layui.treeSelect;
        formSelects = layui.formSelects;

        //监听提交
        form.on('submit(LAY-form-submit)', function(data) {
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            console.log(data)
            //提交ajax成功后，关闭当前弹层并重载表格
            jwt.ajax({
                url: '${base}/comm/rsynctable/save',
                data: data.field,
                success: function(json) {
                    parent.layui.table.reload('LAY-table'); //重载表格
                    parent.layer.close(index); //再执行关闭
                }
            });
        });
    })
</script>
</body>
</html>